import request from './request.js'


export function getAllSubProjectList(data) {
  return request({
    url: '/Project/getAllSub',
    method: 'get',
    data: data,
  })
}
export function getProjectList(data) {
  return request({
    url: '/Project/Get_sub',
    method: 'post',
    data: data,
  })
}

export function getLargeProjectList(data) {
  return request({
    url: '/Project/get',
    method: 'post',
    data: data,
  })
}
export function addProject(data) {
  return request({
    url: '/Project/Add',
    method: 'post',
    data: data,
  });
}

export function fetchProjects(data) {
  return request({
    url: '/Project/get',
    method: 'post',
    data: data
  });
}
export function fetchSubProjects(id) {
  return request({
    url: `/Project/Get_sub?id=${id}`,
    method: 'post',
  });
}
export function addSubProject(data) {
  return request({
    url: '/Project/Add_sub',
    method: 'post',
    data: data
  });
}
export function deleteSubProject(id) {
  return request({
    url: `/Project/Delete_sub?Id=${id}`,
    method: 'post',
  });
}

export function updateProject(data) {
  return request({
    url: '/Project/update',
    method: 'post',
    data: data
  });
}
//删除大项目
export function deleteProject(id) {
  return request({
    url: `/Project/Delete?Id=${id}`,
    method: 'post',
  });
}
//获取分项目人员列表
export function fetchSubProjectEmployees(subProjectId) {
  return request({
    url: `/subemp/get?subId=${subProjectId}`,
    method: 'get',
  });
}
//修改分项目信息
export function updateSubProject(data) {
  return request({
    url: `/Project/update_sub`,
    method: 'post',
    data : data
  });
}
export function addSubemp(data) {
  return request({
    url: `/subemp/add`,
    method: 'post',
    data: data
  });
}
export function deleteSubemp(data) {
  return request({
    url: `/subemp/delete`,
    method: 'post',
    data: data
  });
}
export function collectSubProject(id, time) {
  return request({
    url: `/Project/collect?Id=${id}&time=${time}`,
    method: 'post',
  });
}
export function fetchSubProjectAttendance(subProjectId,date) {
  return request({
    url: `/Project/subDetail?id=${subProjectId}&date=${date}`,
    method: 'get',
  });
}

export function fetchSubProjectSummary(subProjectId,date) {
  return request({
    url: `/Project/collect_sub?id=${subProjectId}&date=${date}`,
    method: 'post',
  });
}

